package com.demo.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.demo.model.ExamEntity;

public class ExamRowMapper implements RowMapper{

	@Override
	public ExamEntity mapRow(ResultSet rs, int index) throws SQLException {
		ExamEntity entity = new ExamEntity();
		entity.setId(rs.getInt("id"));
		entity.setQuestion(rs.getString("question"));  
		entity.setOptionsStr(rs.getString("options"));  
		entity.setAnswer(rs.getString("answer"));
		entity.setAnalysis(rs.getString("ana"));
		entity.setSubjectId(rs.getInt("subject_id"));
		entity.setGradeId(rs.getInt("grade_id"));
		entity.setType(rs.getInt("type"));
		entity.setRank(rs.getInt("rank"));
		entity.setKnowledgeId(rs.getInt("knowledge_id"));
		entity.setChapterId(rs.getInt("chapter_id"));
		entity.setStatus(rs.getInt("status"));
		return entity;
	}

}
